package sjtu.sonnet.LDAPModule.logic.controller;

import javax.naming.NamingException;

import sjtu.sonnet.LDAPModule.logic.interfraces.iLDAPController;
import sjtu.sonnet.LDAPModule.service.impl.LDAPConnection;
import sjtu.sonnet.LDAPModule.service.interfaces.LDAPManager;

public class ControllerFactory {
	private ControllerFactory() {

	}

	public static ControllerFactory getInstance() throws NamingException {
		if (factory == null) {
			ldapController = new LDAPController();
			ldapManager = new LDAPConnection();
			ldapController.setLdapManager(ldapManager);
			return new ControllerFactory();
		}
		return null;
	}

	public iLDAPController getLdapController() {
		return ldapController;
	}

	private static LDAPManager ldapManager = null;
	private static iLDAPController ldapController = null;
	private static ControllerFactory factory = null;

}
